package com.interview;

import com.sun.org.apache.xml.internal.security.transforms.implementations.TransformC14NExclusive;

import javax.crypto.interfaces.PBEKey;

public class ThreadTest {
    public static void main(String[] args) throws InterruptedException {
        final Object obj = new Object();
        Thread t1 = new Thread(){
            public void run(){
                synchronized (obj){
                    try {
                        obj.wait();
                        System.out.println("Thread 1 wake up.");
                    }catch (InterruptedException e){

                    }
                }
            }
        };
        t1.start();

        Thread.sleep(1000);
        Thread t2 = new Thread(){
            public void run(){
                synchronized (obj){
                    obj.notifyAll();
                    System.out.println("Thread2 sentnotfy.");
                }
            }
        };
        t2.start();
    }
}
